package com.auxgroup.smarthome.business.repo;

import com.auxgroup.smarthome.business.entity.AppPushTemplateEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * Created by niuGuangzhe on 2017/8/7.
 */
public interface AppPushTemplateRepo
        extends JpaRepository<AppPushTemplateEntity, String>, JpaSpecificationExecutor<AppPushTemplateEntity> {

    AppPushTemplateEntity findByTemplateIdAndStatusLessThan(@Param("templateId") String templateId,
                                                             @Param("isEnable") Integer isEnable);


    //逻辑删除
    @Modifying
    @Query("update AppPushTemplateEntity o set o.status=?2 where o.templateId=?1")
    int logicallyDelete(String templateId,Integer status);
}
